package org.edu.service.impl;

import java.util.List;

import org.edu.dao.StudentDao;
import org.edu.model.Student;
import org.edu.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("studentService")
public class StudentServiceImpl implements StudentService {

	@Autowired
	StudentDao studentDao;

	public StudentServiceImpl() {
	}

	@Transactional
	public void save(Student student) throws Exception {
		studentDao.save(student);
	}

	@Transactional
	public void update(Student student) throws Exception {
		studentDao.update(student);
	}

	@Transactional
	public void remove(Student student) throws Exception {
		studentDao.remove(student);
	}

	@Transactional
	public List<Student> students() {
		return studentDao.students();
	}

	@Transactional
	public Student findById(Long student_id) throws Exception {
		return studentDao.findById(student_id);
	}

}
